Results 1 to 6 of 6

Thread: Lightning Strike..

  1. #1

    Default Lightning Strike..

    Here's a basic lightning strike I have completed. Just save this as lightning.scr in your global or where-ever folder, and exec in your map when you want it as "exec global/lightning.scr ( xxx xxx xxx )"

    Currently modifying this to hit 93 random spots in my Destroyed Village, doing either damage or giving the player more health, both types hit the same random spots.

    Change the settings to how you want em
    It's called hurtlightning because I use two, one to heal and one to hurt.

    Also more fun if you edit your ubersound to setup thunder for all maps and use this as well, just throw it in under the main local.origin:

    Code:
    local.master aliascache thunder1 sound/amb/Amb_Thunder_01.wav soundparms 1.0 0.0 1.0 0.0 3000 6000 auto streamed maps "m dm moh obj train"
    Click image for larger version. 

Name:	lightning.JPG 
Views:	28 
Size:	196.2 KB 
ID:	1404

    Code:
    main local.origin:
    
    //First spawn the lightning and deactivate it
    local.hurtlightning = spawn func_beam targetname "hurtlightning"
    local.hurtlightning.origin = local.origin //ground point origin
    local.hurtlightning.scale = 3.5 //Big main bolt
    $hurtlightning endpoint ( local.hurtlightning.origin + ( 0 0 2000) ) //Make it stretch into the sky
    $hurtlightning minoffset 0.0
    $hurtlightning maxoffset 13.0 //Makes it squiggly, up to 100 i think?
    $hurtlightning numsegments 45 //Changes how squiggly, play with these you'll see what I mean.
    $hurtlightning deactivate 
    $hurtlightning light (1 1 1) //Set the light here since it won't change
    
    //Now for small color changing beams to give it a nice look
    //Beam1
    local.hurtlightningeffects1 = spawn func_beam targetname "hurtlightningeffects1"
    local.hurtlightningeffects1.origin = local.hurtlightning.origin
    local.hurtlightningeffects1.scale = 1
    $hurtlightningeffects1 endpoint ( local.hurtlightning.origin + ( 0 0 3000 ) )
    $hurtlightningeffects1 minoffset 0.0
    $hurtlightningeffects1 maxoffset 20.0
    $hurtlightningeffects1 numsegments 30
    $hurtlightningeffects1 deactivate 
    //Beam2
    local.hurtlightningeffects2 = spawn func_beam targetname "hurtlightningeffects2"
    local.hurtlightningeffects2.origin = local.hurtlightning.origin
    local.hurtlightningeffects2.scale = 1
    $hurtlightningeffects2 endpoint ( local.hurtlightning.origin + ( 0 0 3000 ) )
    $hurtlightningeffects2 minoffset 0.0
    $hurtlightningeffects2 maxoffset 20.0
    $hurtlightningeffects2 numsegments 30
    $hurtlightningeffects2 deactivate 
    
    //Now setup waits and color
    while(1) {
    	wait 30 //How often do you want lightning to strike this area?
            //Play our thunder
    	$world playsound thunder1
            //Turn on our beams
    	$hurtlightning activate
    	$hurtlightningeffects1 activate
    	$hurtlightningeffects2 activate
            //Start changing colors ever 1/2 second, this also determines how long lightning lasts, currently 4 seconds
            //Since we can't do radiusdamage for 4 seconds we do 8 chunks of half second waits to simulate
            //Constant damage. Change this down to just one if you only want a quick style lightning strike
    	$hurtlightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	$hurtlightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	radiusdamage $hurtlightning.origin 500 200 //Give it damage
    	wait 0.5
    	$hurtlightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	$hurtlightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	radiusdamage $hurtlightningeffects1.origin 500 150
    	wait 0.5
    	$hurtlightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	$hurtlightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	radiusdamage $hurtlightningeffects2.origin 500 150
    	wait 0.5
    	$hurtlightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	$hurtlightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	radiusdamage $hurtlightning.origin 500 150
    	wait 0.5
    	$hurtlightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	$hurtlightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	radiusdamage $hurtlightningeffects1.origin 500 150
    	wait 0.5
    	$hurtlightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	$hurtlightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	radiusdamage $hurtlightningeffects2.origin 500 150
    	wait 0.5
    	$hurtlightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	$hurtlightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	radiusdamage $hurtlightningeffects2.origin 500 150
    	wait 0.5
    	$hurtlightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	$hurtlightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	radiusdamage $hurtlightning.origin 500 150
    	wait 0.5
    	$hurtlightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	$hurtlightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    	radiusdamage $hurtlightningeffects1.origin 500 150
            //Turn everything back off
    	$hurtlightningeffects1 lightOff
    	$hurtlightningeffects2 lightOff
    	$hurtlightning deactivate
    	$hurtlightningeffects1 deactivate
    	$hurtlightningeffects2 deactivate
    }
    end
    Last edited by Gotcha; July 18th, 2015 at 02:27 AM.

  2. #2
    Senior Member nene81's Avatar
    Join Date
    Nov 2014
    Location
    Seville, SPAIN
    Posts
    180

    Default

    It seems interesting...
    I will check with a twice of custommaps.

    Good job!

  3. #3
    Senior Member nene81's Avatar
    Join Date
    Nov 2014
    Location
    Seville, SPAIN
    Posts
    180

    Default

    Hi again!

    I have tried this .scr along with rain.scr & gewitter ambient sound, it is so good.

    Im going to use botnodes to generate random origin...
    I will tell you...

  4. #4

    Default

    You could also set it up using

    level.spot[0]
    level.spot[1]

    etc.

    Here's the version I run in my Destroyed Village. It uses 94 different coords, and picks a random lightning (either hurt, or give health) edit as you wish, i figure you'll remove the healing lightning. Script may need a lil work, I only tested it once but it seemed to be working fine

    Code:
    local.master aliascache thunder1 sound/amb/Amb_Thunder_01.wav soundparms 1.0 0.0 1.0 0.0 1000 10000 auto streamed maps "m dm moh obj train"
    
    //Now setup the coords, waits, and effects
    calllightning:
    	level.spot[0] = ( 211 -1363 -45 )
    	level.spot[1] = ( -539 -1404 -34 )
    	level.spot[2] = ( -813 -1931 -55 )
    	level.spot[3] = ( -897 -2623 -62 )
    	level.spot[4] = ( -1587 -2639 -102 )
    	level.spot[5] = ( -1998 -2377 -153 )
    	level.spot[6] = ( -2304 -2651 -116 )
    	level.spot[7] = ( -2664 -2434 -110 )
    	level.spot[8] = ( -2965 -2469 -42 )
    	level.spot[9] = ( -3355 -2316 -35 )
    	level.spot[10] = ( -3016 -2084 -93 )
    	level.spot[11] = ( -3288 -1853 -64 )
    	level.spot[12] = ( -3138 -1811 -66 )
    	level.spot[13] = ( -2983 -1643 -51 )
    	level.spot[14] = ( -3228 -1487 -25 )
    	level.spot[15] = ( -3236 -1278 -12 )
    	level.spot[16] = ( -3040 -1233 -4 )
    	level.spot[17] = ( -2695 -1425 93 )
    	level.spot[18] = ( -2498 -1325 185 )
    	level.spot[19] = ( -2362 -1229 106 )
    	level.spot[21] = ( -2694 -1167 49 )
    	level.spot[22] = ( -3111 -1144 0 )
    	level.spot[23] = ( -2881 -863 6 )
    	level.spot[24] = ( -2830 -487 151 )
    	level.spot[25] = ( -3019 -451 71 )
    	level.spot[26] = ( -2865 -294 22 )
    	level.spot[27] = ( -2658 -103 48 )
    	level.spot[28] = ( -3045 142 27 )
    	level.spot[29] = ( -2885 238 42 )
    	level.spot[30] = ( -3038 603 -58 )
    	level.spot[31] = ( -2951 843 19 )
    	level.spot[32] = ( -2540 697 32 )
    	level.spot[33] = ( -2523 1103 -52 )
    	level.spot[34] = ( -2811 1261 91 )
    	level.spot[35] = ( -2019 1255 24 )
    	level.spot[36] = ( -1795 892 90 )
    	level.spot[37] = ( -1954 503 167 )
    	level.spot[38] = ( -1612 374 26 )
    	level.spot[39] = ( -1195 410 24 )
    	level.spot[40] = ( -994 1089 -63 )
    	level.spot[41] = ( -862 1456 121 )
    	level.spot[42] = ( -576 1220 24 )
    	level.spot[43] = ( -1028 694 31 )
    	level.spot[44] = ( -1419 446 26 )
    	level.spot[45] = ( -1735 58 0 )
    	level.spot[46] = ( -1580 -88 -21 )
    	level.spot[47] = ( -1328 -192 2 )
    	level.spot[48] = ( -1465 -427 -22 )
    	level.spot[49] = ( -1647 -684 -29 )
    	level.spot[50] = ( -1839 -648 90 )
    	level.spot[51] = ( -1914 -576 16 )
    	level.spot[52] = ( -1592 -621 -29 )
    	level.spot[53] = ( -1723 -830 0 )
    	level.spot[54] = ( -1841 -925 16 )
    	level.spot[55] = ( -1781 -1112 -1 )
    	level.spot[56] = ( -1664 -1485 18 )
    	level.spot[57] = ( -1759 -1642 63 )
    	level.spot[58] = ( -1639 -1547 28 )
    	level.spot[59] = ( -1642 -1336 -6 )
    	level.spot[60] = ( -1514 -1253 -31 )
    	level.spot[61] = ( -1438 -1420 -31 )
    	level.spot[62] = ( -1378 -1579 -9 )
    	level.spot[63] = ( -1264 -1582 11 )
    	level.spot[64] = ( -1082 -1724 18 )
    	level.spot[65] = ( -1100 -1480 -33 )
    	level.spot[66] = ( -1069 -1369 -37 )
    	level.spot[67] = ( -822 -1309 -29 )
    	level.spot[68] = ( -721 -1195 -3 )
    	level.spot[69] = ( -640 -1361 -28 )
    	level.spot[70] = ( -497 -1579 -49 )
    	level.spot[71] = ( -515 -1616 -45 )
    	level.spot[72] = ( -406 -1275 -20 )
    	level.spot[73] = ( -364 -1021 8 )
    	level.spot[74] = ( -118 -1425 -42 )
    	level.spot[75] = ( 20 -981 -50 )
    	level.spot[76] = ( 262 -1034 22 )
    	level.spot[77] = ( 297 -1052 -28 )
    	level.spot[78] = ( 205 -535 -3 )
    	level.spot[79] = ( 592 -435 -63 )
    	level.spot[80] = ( 299 -286 -26 )
    	level.spot[81] = ( 381 -79 -22 )
    	level.spot[82] = ( 356 235 -20 )
    	level.spot[83] = ( 198 148 22 )
    	level.spot[84] = ( -96 83 28 )
    	level.spot[85] = ( -258 370 50 )
    	level.spot[86] = ( 34 601 -52 )
    	level.spot[87] = ( 88 860 37 )
    	level.spot[88] = ( -126 1055 24 )
    	level.spot[89] = ( -353 793 29 )
    	level.spot[90] = ( -570 971 8 )
    	level.spot[91] = ( -1578 1425 77 )
    	level.spot[92] = ( -2411 1414 122 )
    	level.spot[93] = ( -2852 1582 240 )
    	
    	local.random = randomint(level.spot.size )
    	
    	wait 1 //Just to give it time to settle, probably not necessary
    	
    	level.lightning[0] = lightning
    	level.lightning[1] = heallightning
    	
    	local.random2 = randomint(level.lightning.size )
    	
    	wait 1 //Just to give it time to settle, probably not necessary
    	
    	thread (level.lightning[local.random2]) ( level.spot[local.random] ) //<- If you remove heal lightning change this to 'thread lightning' and remove the level.lightning[0] and [1] from below the wait 1
    	wait 13 //This plus 2 = wait
    	thread calllightning
    
    lightning local.origin:
    local.random = randomint(level.spot.size )
    local.lightning = spawn func_beam targetname "lightning"
    local.lightning.origin = local.origin
    local.lightning.scale = 3.5
    $lightning endpoint ( local.lightning.origin + ( 0 0 900 ) )
    $lightning minoffset 0.0
    $lightning maxoffset 13.0
    $lightning numsegments 45
    $lightning deactivate 
    $lightning light (1 1 1)
    
    local.lightningeffects1 = spawn func_beam targetname "lightningeffects1"
    local.lightningeffects1.origin = local.lightning.origin
    local.lightningeffects1.scale = 1
    $lightningeffects1 endpoint ( local.lightning.origin + ( 0 0 900 ) )
    $lightningeffects1 minoffset 0.0
    $lightningeffects1 maxoffset 20.0
    $lightningeffects1 numsegments 30
    $lightningeffects1 deactivate 
    
    local.lightningeffects2 = spawn func_beam targetname "lightningeffects2"
    local.lightningeffects2.origin = local.lightning.origin
    local.lightningeffects2.scale = 1
    $lightningeffects2 endpoint ( local.lightning.origin + ( 0 0 900 ) )
    $lightningeffects2 minoffset 0.0
    $lightningeffects2 maxoffset 20.0
    $lightningeffects2 numsegments 30
    $lightningeffects2 deactivate 
    
    $world playsound thunder1
    $lightning activate
    $lightningeffects1 activate
    $lightningeffects2 activate
    $lightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    $lightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    radiusdamage $lightning.origin 500 200
    wait 0.5
    $lightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    $lightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    radiusdamage $lightningeffects1.origin 500 150
    wait 0.5
    $lightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    $lightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    radiusdamage $lightningeffects2.origin 500 150
    wait 0.5
    $lightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    $lightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    radiusdamage $lightning.origin 500 150
    wait 0.5
    $lightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    $lightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    radiusdamage $lightningeffects1.origin 500 150
    wait 0.5
    $lightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    $lightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    radiusdamage $lightningeffects2.origin 500 150
    wait 0.5
    $lightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    $lightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    radiusdamage $lightningeffects2.origin 500 150
    wait 0.5
    $lightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    $lightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    radiusdamage $lightning.origin 500 150
    wait 0.5
    $lightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    $lightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    radiusdamage $lightningeffects1.origin 500 150
    $lightningeffects1 lightOff
    $lightningeffects2 lightOff
    $lightning delete
    $lightningeffects1 delete
    $lightningeffects2 delete
    
    end
    
    heallightning local.origin:
    local.random = randomint(level.spot.size )
    local.hlightning = spawn func_beam targetname "hlightning"
    local.hlightning.origin = local.origin
    local.hlightning.scale = 3.5
    $hlightning endpoint ( local.hlightning.origin + ( 0 0 900 ) )
    $hlightning minoffset 0.0
    $hlightning maxoffset 13.0
    $hlightning numsegments 45
    $hlightning deactivate 
    $hlightning light (1 1 1)
    
    local.hlightningeffects1 = spawn func_beam targetname "hlightningeffects1"
    local.hlightningeffects1.origin = local.hlightning.origin
    local.hlightningeffects1.scale = 1
    $hlightningeffects1 endpoint ( local.hlightning.origin + ( 0 0 900 ) )
    $hlightningeffects1 minoffset 0.0
    $hlightningeffects1 maxoffset 20.0
    $hlightningeffects1 numsegments 30
    $hlightningeffects1 deactivate 
    
    local.hlightningeffects2 = spawn func_beam targetname "hlightningeffects2"
    local.hlightningeffects2.origin = local.hlightning.origin
    local.hlightningeffects2.scale = 1
    $hlightningeffects2 endpoint ( local.hlightning.origin + ( 0 0 900 ) )
    $hlightningeffects2 minoffset 0.0
    $hlightningeffects2 maxoffset 20.0
    $hlightningeffects2 numsegments 30
    $hlightningeffects2 deactivate 
    
    local.trig = spawn trigger_multiple targetname "htrig"
    local.trig.origin = local.hlightning.origin
    local.trig setsize ( -30 -30 -30 ) ( 30 30 30 )
    local.trig setthread heal
    
    $world playsound thunder1
    $hlightning activate
    $hlightningeffects1 activate
    $hlightningeffects2 activate
    $hlightningeffects1 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    $hlightningeffects2 light ((randomfloat(0.999)) (randomfloat(0.999)) (randomfloat(0.999)))
    wait 4
    $hlightningeffects1 lightOff
    $hlightningeffects2 lightOff
    $hlightning delete
    $htrig delete
    $hlightningeffects1 delete
    $hlightningeffects2 delete
    
    end
    
    heal:
    local.player = parm.other
    
    if(local.player.healed == 1) //So he only gets healed once, not the whole time it's happening
    end
    
    local.player volumedamage -540
    local.player.healed = 1
    
    end
    I have a version of this, exact method, minus the hurt and heal ( I just needed the visual effect) for my new stally mod, Gotcha's Playhouse
    Last edited by Gotcha; July 29th, 2015 at 07:13 PM.

  5. #5
    Senior Member nene81's Avatar
    Join Date
    Nov 2014
    Location
    Seville, SPAIN
    Posts
    180

    Default

    How can I give health (increase) to a player?

  6. #6

    Default

    That second script I posted shows how to make it give health. If you just want that part you could cut the hurt lightning out

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •